package com.kystar.muxplayer.model;

import android.os.Parcel;
import android.os.Parcelable;
import java.io.Serializable;

public class EDID implements Parcelable,Serializable {

    private FreqType freqType = FreqType.HZ60;
    private int width = 1920;
    private int height = 1080;

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public FreqType getFreqType() {
        return freqType;
    }

    public void setFreqType(FreqType freqType) {
        this.freqType = freqType;
    }

    public String getInfo() {
        return width + "x" + height + "@" + freqType.name;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.freqType == null ? -1 : this.freqType.ordinal());
        dest.writeInt(this.width);
        dest.writeInt(this.height);
    }

    public EDID() {
    }

    protected EDID(Parcel in) {
        int tmpFreqType = in.readInt();
        this.freqType = tmpFreqType == -1 ? null : FreqType.values()[tmpFreqType];
        this.width = in.readInt();
        this.height = in.readInt();
    }

    public static final Creator<EDID> CREATOR = new Creator<EDID>() {
        @Override
        public EDID createFromParcel(Parcel source) {
            return new EDID(source);
        }

        @Override
        public EDID[] newArray(int size) {
            return new EDID[size];
        }
    };
}
